package br.com.mobile.scrum.activity;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import br.com.mobile.scrum.R;
import br.com.mobile.scrum.domain.Project;

public class ArrayAdapterCustom extends BaseAdapter{
	
	private Context context;
	int resource;
	List<Project> objects;

	public ArrayAdapterCustom(Context context,
			List<Project> objects) {

		this.context = context;
		this.objects = objects;
	}
	
	public int getCount(){
		return objects.size();
	}
	
	public long getItemId(int position){
		return position;
	}

	@Override
	public Object getItem(int position) {
		return objects.get(position);
	}

	@Override
	public View getView(int position, View view, ViewGroup parent) {
		Project project = objects.get(0); 
		
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		
		View v = inflater.inflate(R.layout.projects_view_list, null);
		
		ImageView img = (ImageView) v.findViewById(R.id.img);
		TextView textDescription = (TextView) v.findViewById(R.id.fieldDescription);
		
		textDescription.setText(project.getDescription());
		
		return v;
		
	}
	
	
	
}
